Add allowed UUIDs and ignore CEC to Google Cast options flow#47269
Conversation
|
Rebase? |
22da381 to
d80b8ea
Compare
| from .const import DOMAIN | ||
|
|
||
| # Deprecated from 2021.4, remove in 2021.6 | ||
| CONFIG_SCHEMA = cv.deprecated(DOMAIN) |
There was a problem hiding this comment.
Wow, we had no config schema to begin with and just passed that to import? 🤔
| _add_with_suggestion(fields, CONF_KNOWN_HOSTS, suggested_value) | ||
| suggested_value = _list_to_string(current_config.get(CONF_UUID)) | ||
| _add_with_suggestion(fields, CONF_UUID, suggested_value) | ||
| suggested_value = _list_to_string(current_config.get(CONF_IGNORE_CEC)) | ||
| _add_with_suggestion(fields, CONF_IGNORE_CEC, suggested_value) |
There was a problem hiding this comment.
We know if this flow is requested by an advanced user. Let's hide UUID and IGNORE CEC unless users are advanced.
| if CONF_UUID in config: | ||
| wanted_uuid = config[CONF_UUID] | ||
| # Import CEC IGNORE attributes | ||
| pychromecast.IGNORE_CEC += config_entry.data.get(CONF_IGNORE_CEC) or [] |
There was a problem hiding this comment.
It's a bit weird that we're modifying a constant.
There was a problem hiding this comment.
Yes, but that's how the lib is designed. It could be refactored to a more sane API, with a setter function, but not in this PR.
| cfg = ENTITY_SCHEMA(cfg) | ||
| media_player_config_validated.append(cfg) | ||
| except vol.Error as ex: | ||
| _LOGGER.warning("Invalid config '%s': %s", cfg, ex) |
There was a problem hiding this comment.
Do we accept a partial valid config to be more backwards compatible? The alternative would be to extend the config schema instead which would fail the whole config on invalid result.
There was a problem hiding this comment.
Yes, the intention is to accept a partial valid config by simply skipping invalid media players instead of rejecting the entire config.
MartinHjelmare
left a comment
There was a problem hiding this comment.
Normally the config flow tests should be part of a module test_config_flow.py.
|
Marking as breaking change to highlight the YAML deprecation. |
Breaking change
Proposed change
Make allowed UUIDs and ignore CEC lists configurable through Google Cast options flow
Deprecate cast yaml config
Type of change
Additional information
Checklist
black --fast homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all..coveragerc.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: